/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wyps.ui;

import com.wyps.entity.Conf;
import com.wyps.entity.Field;
import com.wyps.entity.ListConf;
import com.wyps.entity.LoginConf;
import com.wyps.entity.Path;
import com.wyps.entity.PathType;
import com.wyps.entity.User;
import com.wyps.entity.tools.CommonUtils;
import com.wyps.entity.tools.GrapPage;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.swing.filechooser.FileFilter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import net.sf.json.JSONObject;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

/**
 *
 * @author ying.chen
 */
public class MainFrame extends javax.swing.JFrame implements ItemListener, MouseListener, ActionListener, Runnable {

    private Conf conf;
    private ConfDialog confDialog;
    private DefaultTableModel listRecords;
    private Vector<String> columnNames1 = new Vector<String>();
    private Vector<Vector> rowData1 = new Vector<Vector>();
    private GrapPage grapPage;
    private WebDriver webDriver;
    private JFileChooser chooser;
    private FileFilter filter;
    private User user;
    Thread t;

    public Conf getConf() {
        return conf;
    }

    public void setConf(Conf conf) {
        this.conf = conf;
    }

    /**
     * Creates new form MainFrame
     */
    public MainFrame(User user) {
        this.user = user;
        initComponents();
        iniListener();
        iniData();

        this.setTitle("红皇后采集器");
        Image image = new ImageIcon(this.getClass().getResource(
                "/asset/ico.jpg")).getImage();
        this.setIconImage(image);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int centerX = screenSize.width / 2;
        int centerY = screenSize.height / 2;
        this.setLocation(centerX - this.getWidth() / 2, centerY - this.getHeight() / 2 - 30);
        this.setVisible(true);
        this.setResizable(false);
        // 窗体全屏
        // this.setExtendedState(JFrame.MAXIMIZED_BOTH);
        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                super.windowClosing(e);
                int result = JOptionPane.showConfirmDialog(null, "是否退出程序？",
                        "确认", JOptionPane.YES_NO_OPTION);
                if (result == JOptionPane.YES_OPTION) {
                    System.exit(0);
                }
            }

        });
        this.setResizable(false);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        isNeedLoginCheck = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();
        loginUrlField = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        listField = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        fenyeField = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        pageCount = new javax.swing.JSpinner();
        jLabel5 = new javax.swing.JLabel();
        listPath = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        field1Check = new javax.swing.JCheckBox();
        field1 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        field1Val = new javax.swing.JTextField();
        field2Check = new javax.swing.JCheckBox();
        field2 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        field2Val = new javax.swing.JTextField();
        field3Check = new javax.swing.JCheckBox();
        field3 = new javax.swing.JTextField();
        field3Val = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        field4Check = new javax.swing.JCheckBox();
        jLabel9 = new javax.swing.JLabel();
        field4 = new javax.swing.JTextField();
        field4Val = new javax.swing.JTextField();
        field5Check = new javax.swing.JCheckBox();
        field5 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        field5Val = new javax.swing.JTextField();
        field6Check = new javax.swing.JCheckBox();
        field6 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        field6Val = new javax.swing.JTextField();
        field7Check = new javax.swing.JCheckBox();
        field7 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        field7Val = new javax.swing.JTextField();
        field8Check = new javax.swing.JCheckBox();
        field8 = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        field8Val = new javax.swing.JTextField();
        field9Check = new javax.swing.JCheckBox();
        field9 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        field9Val = new javax.swing.JTextField();
        field10Check = new javax.swing.JCheckBox();
        field10 = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        field10Val = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        confName = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        field1Get = new javax.swing.JTextField();
        field2Get = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        field3Get = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        field4Get = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        field5Get = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        field6Get = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        field7Get = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        field8Get = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        field9Get = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        field10Get = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        isNeedClick = new javax.swing.JCheckBox();
        jLabel27 = new javax.swing.JLabel();
        waitTime = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt = new javax.swing.JTable();
        startBt = new javax.swing.JButton();
        stopBt = new javax.swing.JButton();
        clearBt = new javax.swing.JButton();
        importBt = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        openItem = new javax.swing.JMenuItem();
        saveItem = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        aboutus = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        isNeedLoginCheck.setText("是否需要登录");

        jLabel1.setText("登录页");

        loginUrlField.setEditable(false);

        jLabel2.setText("列表页");

        jLabel3.setText("分页");

        jLabel4.setText("页数");

        jLabel5.setText("列表规则");

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("采集字段"));

        field1Check.setText("字段1");

        field1.setText("字段1");

        jLabel6.setText("规则");

        field1Val.setMaximumSize(null);

        field2Check.setText("字段2");

        field2.setText("字段2");

        jLabel7.setText("规则");

        field3Check.setText("字段3");

        field3.setText("字段3");

        jLabel8.setText("规则");

        field4Check.setText("字段4");
        field4Check.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                field4CheckActionPerformed(evt);
            }
        });

        jLabel9.setText("规则");

        field4.setText("字段4");

        field5Check.setText("字段5");

        field5.setText("字段5");

        jLabel10.setText("规则");

        field6Check.setText("字段6");

        field6.setText("字段6");
        field6.setFocusCycleRoot(true);

        jLabel11.setText("规则");

        field6Val.setFocusCycleRoot(true);

        field7Check.setText("字段7");

        field7.setText("字段7");

        jLabel12.setText("规则");

        field8Check.setText("字段8");

        field8.setText("字段8");

        jLabel13.setText("规则");

        field9Check.setText("字段9");

        field9.setText("字段9");

        jLabel14.setText("规则");

        field10Check.setText("字段10");

        field10.setText("字段10");

        jLabel15.setText("规则");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(field4Check)
                            .addComponent(field1Check)
                            .addComponent(field2Check)
                            .addComponent(field3Check))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(field1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(field4)
                            .addComponent(field3, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(field2, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field4Val, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel8))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(field3Val)
                                    .addComponent(field2Val)
                                    .addComponent(field1Val, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(field10Check)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field10))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(field9Check)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(field9))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(field8Check)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(field8))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(field7Check)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(field7))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(field6Check)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(field6))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(field5Check)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(field5, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field5Val))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field6Val))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field7Val))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field8Val))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field9Val))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(field10Val)))))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(field1Check)
                    .addComponent(field1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(field1Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(field2Check)
                        .addComponent(field2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel7))
                    .addComponent(field2Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(field3Check)
                    .addComponent(field3Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(field3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel8)))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(field4Check)
                        .addComponent(field4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel9)
                        .addComponent(field4Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(field5Check)
                        .addComponent(field5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel10)
                        .addComponent(field5Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(field6Check)
                        .addComponent(field6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11))
                    .addComponent(field6Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(field7Check)
                        .addComponent(field7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel12))
                    .addComponent(field7Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(field8Check)
                    .addComponent(field8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(field8Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(field9Check)
                        .addComponent(field9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel14)
                    .addComponent(field9Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(field10Check)
                    .addComponent(field10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15)
                    .addComponent(field10Val, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jLabel16.setText("采集名");

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("字段内容(特殊处理)"));

        jLabel17.setText("字段1");

        field1Get.setText("text");

        field2Get.setText("text");

        jLabel18.setText("字段2");

        field3Get.setText("text");

        jLabel19.setText("字段3");

        field4Get.setText("text");

        jLabel20.setText("字段4");

        field5Get.setText("text");

        jLabel21.setText("字段5");

        field6Get.setText("text");

        jLabel22.setText("字段6");

        field7Get.setText("text");

        jLabel23.setText("字段7");

        field8Get.setText("text");

        jLabel24.setText("字段8");

        field9Get.setText("text");

        jLabel25.setText("字段9");

        field10Get.setText("text");

        jLabel26.setText("字段10");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addGap(18, 18, 18)
                        .addComponent(field1Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addGap(18, 18, 18)
                        .addComponent(field2Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addGap(18, 18, 18)
                        .addComponent(field3Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addGap(18, 18, 18)
                        .addComponent(field4Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addGap(18, 18, 18)
                        .addComponent(field5Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(32, 32, 32)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(field10Get, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel25)
                        .addGap(18, 18, 18)
                        .addComponent(field9Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel24)
                        .addGap(18, 18, 18)
                        .addComponent(field8Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addGap(18, 18, 18)
                        .addComponent(field7Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addGap(18, 18, 18)
                        .addComponent(field6Get, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(field1Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel22)
                        .addComponent(field6Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(field2Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel23)
                        .addComponent(field7Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(field3Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel24)
                        .addComponent(field8Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(field4Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel25)
                        .addComponent(field9Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(field5Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel26)
                        .addComponent(field10Get, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(29, Short.MAX_VALUE))
        );

        isNeedClick.setText("是否点击");

        jLabel27.setText("采集间隔(毫秒)");

        waitTime.setText("0");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(21, 21, 21)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLabel1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(loginUrlField))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel2)
                                            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING))
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addGap(10, 10, 10)
                                                .addComponent(listField, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(fenyeField, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(isNeedClick)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(jLabel4)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(pageCount, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(33, 33, 33))))))
                            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(isNeedLoginCheck)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(listPath, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel27)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(waitTime)))
                        .addGap(18, 18, 18))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(45, 45, 45)
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(confName, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(confName, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(isNeedLoginCheck)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(loginUrlField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(listField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(17, 17, 17)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(fenyeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4)
                            .addComponent(pageCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(isNeedClick))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(listPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5)
                            .addComponent(jLabel27)
                            .addComponent(waitTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(28, 28, 28)
                        .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        jTabbedPane1.addTab("参数配置", jPanel1);

        jt.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jt);

        startBt.setText("开始采集");

        stopBt.setText("停止采集");

        clearBt.setText("清空数据");

        importBt.setText("导出数据");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 789, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(clearBt)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(importBt)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(startBt)
                .addGap(18, 18, 18)
                .addComponent(stopBt)
                .addGap(27, 27, 27))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(startBt)
                    .addComponent(stopBt)
                    .addComponent(clearBt)
                    .addComponent(importBt))
                .addGap(0, 30, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("数据采集", jPanel2);

        jMenu1.setText("文件");

        openItem.setText("打开规则");
        jMenu1.add(openItem);

        saveItem.setText("保存规则");
        jMenu1.add(saveItem);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("关于");

        aboutus.setText("关于我们");
        jMenu2.add(aboutus);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void field4CheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_field4CheckActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_field4CheckActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        String windows = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
        try {
            UIManager.setLookAndFeel(windows);
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InstantiationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainFrame(new User()).setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutus;
    private javax.swing.JButton clearBt;
    private javax.swing.JTextField confName;
    private javax.swing.JTextField fenyeField;
    private javax.swing.JTextField field1;
    private javax.swing.JTextField field10;
    private javax.swing.JCheckBox field10Check;
    private javax.swing.JTextField field10Get;
    private javax.swing.JTextField field10Val;
    private javax.swing.JCheckBox field1Check;
    private javax.swing.JTextField field1Get;
    private javax.swing.JTextField field1Val;
    private javax.swing.JTextField field2;
    private javax.swing.JCheckBox field2Check;
    private javax.swing.JTextField field2Get;
    private javax.swing.JTextField field2Val;
    private javax.swing.JTextField field3;
    private javax.swing.JCheckBox field3Check;
    private javax.swing.JTextField field3Get;
    private javax.swing.JTextField field3Val;
    private javax.swing.JTextField field4;
    private javax.swing.JCheckBox field4Check;
    private javax.swing.JTextField field4Get;
    private javax.swing.JTextField field4Val;
    private javax.swing.JTextField field5;
    private javax.swing.JCheckBox field5Check;
    private javax.swing.JTextField field5Get;
    private javax.swing.JTextField field5Val;
    private javax.swing.JTextField field6;
    private javax.swing.JCheckBox field6Check;
    private javax.swing.JTextField field6Get;
    private javax.swing.JTextField field6Val;
    private javax.swing.JTextField field7;
    private javax.swing.JCheckBox field7Check;
    private javax.swing.JTextField field7Get;
    private javax.swing.JTextField field7Val;
    private javax.swing.JTextField field8;
    private javax.swing.JCheckBox field8Check;
    private javax.swing.JTextField field8Get;
    private javax.swing.JTextField field8Val;
    private javax.swing.JTextField field9;
    private javax.swing.JCheckBox field9Check;
    private javax.swing.JTextField field9Get;
    private javax.swing.JTextField field9Val;
    private javax.swing.JButton importBt;
    private javax.swing.JCheckBox isNeedClick;
    private javax.swing.JCheckBox isNeedLoginCheck;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jt;
    private javax.swing.JTextField listField;
    private javax.swing.JTextField listPath;
    private javax.swing.JTextField loginUrlField;
    private javax.swing.JMenuItem openItem;
    private javax.swing.JSpinner pageCount;
    private javax.swing.JMenuItem saveItem;
    private javax.swing.JButton startBt;
    private javax.swing.JButton stopBt;
    private javax.swing.JTextField waitTime;
    // End of variables declaration//GEN-END:variables

    @Override
    public void itemStateChanged(ItemEvent e) {
        JCheckBox box = (JCheckBox) e.getItemSelectable();
        if (box.equals(field1Check)) {
            if (box.isSelected()) {
                field1.setEditable(true);
                field1Val.setEditable(true);
                conf.getFields().get(0).setFieldName(field1.getText());
                conf.getFields().get(0).setIsUse(true);
            } else {
                field1.setEditable(false);
                field1Val.setEditable(false);
                conf.getFields().get(0).setIsUse(false);
            }
        } else if (box.equals(field2Check)) {
            if (box.isSelected()) {
                field2.setEditable(true);
                field2Val.setEditable(true);
                conf.getFields().get(1).setFieldName(field1.getText());
                conf.getFields().get(1).setIsUse(true);
            } else {
                field2.setEditable(false);
                field2Val.setEditable(false);
                conf.getFields().get(1).setIsUse(false);
            }
        } else if (box.equals(field3Check)) {
            if (box.isSelected()) {
                field3.setEditable(true);
                field3Val.setEditable(true);
                conf.getFields().get(2).setFieldName(field1.getText());
                conf.getFields().get(2).setIsUse(true);
            } else {
                field3.setEditable(false);
                field3Val.setEditable(false);
                conf.getFields().get(2).setIsUse(false);
            }
        } else if (box.equals(field4Check)) {
            if (box.isSelected()) {
                field4.setEditable(true);
                field4Val.setEditable(true);
                conf.getFields().get(3).setFieldName(field1.getText());
                conf.getFields().get(3).setIsUse(true);
            } else {
                field4.setEditable(false);
                field4Val.setEditable(false);
                conf.getFields().get(3).setIsUse(false);
            }
        } else if (box.equals(field5Check)) {
            if (box.isSelected()) {
                field5.setEditable(true);
                field5Val.setEditable(true);
                conf.getFields().get(4).setFieldName(field1.getText());
                conf.getFields().get(4).setIsUse(true);
            } else {
                field5.setEditable(false);
                field5Val.setEditable(false);
                conf.getFields().get(4).setIsUse(false);
            }
        } else if (box.equals(field6Check)) {
            if (box.isSelected()) {
                field6.setEditable(true);
                field6Val.setEditable(true);
                conf.getFields().get(5).setFieldName(field1.getText());
                conf.getFields().get(5).setIsUse(true);
            } else {
                field6.setEditable(false);
                field6Val.setEditable(false);
                conf.getFields().get(5).setIsUse(false);
            }
        } else if (box.equals(field7Check)) {
            if (box.isSelected()) {
                field7.setEditable(true);
                field7Val.setEditable(true);
                conf.getFields().get(6).setFieldName(field1.getText());
                conf.getFields().get(6).setIsUse(true);
            } else {
                field7.setEditable(false);
                field7Val.setEditable(false);
                conf.getFields().get(6).setIsUse(false);
            }
        } else if (box.equals(field8Check)) {
            if (box.isSelected()) {
                field8.setEditable(true);
                field8Val.setEditable(true);
                conf.getFields().get(7).setFieldName(field1.getText());
                conf.getFields().get(7).setIsUse(true);
            } else {
                field8.setEditable(false);
                field8Val.setEditable(false);
                conf.getFields().get(7).setIsUse(false);
            }
        } else if (box.equals(field9Check)) {
            if (box.isSelected()) {
                field9.setEditable(true);
                field9Val.setEditable(true);
                conf.getFields().get(8).setFieldName(field1.getText());
                conf.getFields().get(8).setIsUse(true);
            } else {
                field9.setEditable(false);
                field9Val.setEditable(false);
                conf.getFields().get(8).setIsUse(false);
            }
        } else if (box.equals(field10Check)) {
            if (box.isSelected()) {
                field10.setEditable(true);
                field10Val.setEditable(true);
                conf.getFields().get(9).setFieldName(field1.getText());
                conf.getFields().get(9).setIsUse(true);
            } else {
                field10.setEditable(false);
                field10Val.setEditable(false);
                conf.getFields().get(9).setIsUse(false);
            }
        } else if (box.equals(isNeedLoginCheck)) {
            if (box.isSelected()) {
                loginUrlField.setEditable(true);
                conf.getLoginconf().setNeedLogin(true);
            } else {
                loginUrlField.setEditable(false);
                conf.getLoginconf().setNeedLogin(false);

            }

        } else if (box.equals(isNeedClick)) {
            if (box.isSelected()) {
                conf.getListConf().setIsNeedClick(true);
            } else {
                conf.getListConf().setIsNeedClick(false);

            }

        }

    }

    private void iniListener() {
        field1Check.addItemListener(this);

        field2Check.addItemListener(this);

        field3Check.addItemListener(this);

        field4Check.addItemListener(this);

        field5Check.addItemListener(this);

        field6Check.addItemListener(this);

        field7Check.addItemListener(this);

        field8Check.addItemListener(this);

        field9Check.addItemListener(this);

        field10Check.addItemListener(this);
        isNeedLoginCheck.addItemListener(this);
        listField.addMouseListener(this);
        fenyeField.addMouseListener(this);
        listPath.addMouseListener(this);
        field1Val.addMouseListener(this);
        field2Val.addMouseListener(this);
        field3Val.addMouseListener(this);
        field4Val.addMouseListener(this);
        field5Val.addMouseListener(this);
        field6Val.addMouseListener(this);
        field7Val.addMouseListener(this);
        field8Val.addMouseListener(this);
        field9Val.addMouseListener(this);
        field10Val.addMouseListener(this);
        isNeedClick.addItemListener(this);
        startBt.addActionListener(this);
        stopBt.addActionListener(this);
        stopBt.setEnabled(false);
        clearBt.addActionListener(this);
        importBt.addActionListener(this);
        openItem.addActionListener(this);
        saveItem.addActionListener(this);
        aboutus.addActionListener(this);
        jTabbedPane1.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
                int selectedIndex = tabbedPane.getSelectedIndex();

                if (selectedIndex == 1) {
                    saveConf();
                    listRecords = new DefaultTableModel(rowData1, columnNames1);

                    jt.setModel(listRecords);
                }
            }
        });
    }

    public void saveConf() {
        columnNames1 = new Vector<String>();
        conf.getListConf().setUrl(listField.getText());
        conf.getListConf().setPageCount((int) pageCount.getValue());
        conf.setWaitTime(Integer.parseInt(waitTime.getText()));
        conf.setConfName(confName.getText());
        for (int i = 0; i < conf.getFields().size(); i++) {
            if (conf.getFields().get(i).isIsUse()) {
                if (i == 0) {
                    setFieldGet(field1Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field1.getText());
                    columnNames1.add(field1.getText());
                } else if (i == 1) {
                    setFieldGet(field2Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field2.getText());

                    columnNames1.add(field2.getText());
                } else if (i == 2) {
                    setFieldGet(field3Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field3.getText());
                    columnNames1.add(field3.getText());
                } else if (i == 3) {
                    setFieldGet(field4Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field4.getText());
                    columnNames1.add(field4.getText());
                } else if (i == 4) {
                    setFieldGet(field5Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field5.getText());
                    columnNames1.add(field5.getText());
                } else if (i == 5) {
                    setFieldGet(field6Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field6.getText());
                    columnNames1.add(field6.getText());
                } else if (i == 6) {
                    setFieldGet(field7Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field7.getText());
                    columnNames1.add(field7.getText());
                } else if (i == 7) {
                    setFieldGet(field8Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field8.getText());
                    columnNames1.add(field8.getText());
                } else if (i == 8) {
                    setFieldGet(field9Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field9.getText());
                    columnNames1.add(field9.getText());
                } else if (i == 9) {
                    setFieldGet(field10Get.getText(), conf.getFields().get(i).getFieldGet());
                    conf.getFields().get(i).setFieldName(field10.getText());
                    columnNames1.add(field10.getText());
                }

            }
        }
    }

    public void setFieldGet(String v, Path p) {
        if (CommonUtils.isEmpty(v)) {
            return;
        }
        if (v.equals("text")) {
            p.setType(PathType.text);
        } else if (v.equals("click")) {
            p.setType(PathType.click);
        } else {
            p.setType(PathType.attr);
        }
        p.setValue(v);
    }

    private void iniData() {
        field1.setEditable(false);
        field1Val.setEditable(false);
        field2.setEditable(false);
        field2Val.setEditable(false);
        field3.setEditable(false);
        field3Val.setEditable(false);
        field4.setEditable(false);
        field4Val.setEditable(false);
        field5.setEditable(false);
        field5Val.setEditable(false);
        field6.setEditable(false);
        field6Val.setEditable(false);
        field7.setEditable(false);
        field7Val.setEditable(false);
        field8.setEditable(false);
        field8Val.setEditable(false);
        field9.setEditable(false);
        field9Val.setEditable(false);
        field10.setEditable(false);
        field10Val.setEditable(false);
        pageCount.setValue(10);
        LoginConf loginConf = new LoginConf();
        ListConf listConf = new ListConf();
        List<Field> fields = new ArrayList<Field>();
        for (int i = 0; i < 10; i++) {
            Field field = new Field();
            fields.add(field);
        }
        conf = new Conf();
        conf.setFields(fields);
        conf.setListConf(listConf);
        conf.setLoginconf(loginConf);
        chooser = new JFileChooser();
        filter = new FileNameExtensionFilter("请选择规则文件.obj", "obj");
        chooser.setFileFilter(filter);// 设置文件后缀过滤器

    }

    @Override
    public void mouseClicked(MouseEvent e) {
        if (e.getSource().equals(fenyeField)) {
            confDialog = new ConfDialog(fenyeField, this.conf.getListConf().getNextUrl(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(listPath)) {
            confDialog = new ConfDialog(listPath, this.conf.getListConf().getListPath(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field1Val)) {
            confDialog = new ConfDialog(field1Val, this.conf.getFields().get(0).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field2Val)) {
            confDialog = new ConfDialog(field2Val, this.conf.getFields().get(1).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field3Val)) {
            confDialog = new ConfDialog(field3Val, this.conf.getFields().get(2).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field4Val)) {
            confDialog = new ConfDialog(field4Val, this.conf.getFields().get(3).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field5Val)) {
            confDialog = new ConfDialog(field5Val, this.conf.getFields().get(4).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field6Val)) {
            confDialog = new ConfDialog(field6Val, this.conf.getFields().get(5).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field7Val)) {
            confDialog = new ConfDialog(field7Val, this.conf.getFields().get(6).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field8Val)) {
            confDialog = new ConfDialog(field8Val, this.conf.getFields().get(7).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field9Val)) {
            confDialog = new ConfDialog(field9Val, this.conf.getFields().get(8).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        } else if (e.getSource().equals(field10Val)) {
            confDialog = new ConfDialog(field10Val, this.conf.getFields().get(9).getFieldVal(), this, true);
            confDialog.setLocationRelativeTo(null);
            confDialog.setVisible(true);
        }

    }

    @Override
    public void mousePressed(MouseEvent e) {
    }

    @Override
    public void mouseReleased(MouseEvent e) {
    }

    @Override
    public void mouseEntered(MouseEvent e) {
    }

    @Override
    public void mouseExited(MouseEvent e) {
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource().equals(startBt)) {
            System.setProperty("webdriver.chrome.driver", this.getClass().getResource("/asset/chromedriver.exe").getPath());
            webDriver = new ChromeDriver();
            grapPage = new GrapPage();
            grapPage.setStopflag(false);
            startBt.setEnabled(false);
            stopBt.setEnabled(true);
            grapPage.setListRecords(listRecords);
            t = new Thread(this);
            t.start();
        } else if (e.getSource().equals(aboutus)) {
            AboutUsDialog aboutUsDialog = new AboutUsDialog(this,true);
            aboutUsDialog.setLocationRelativeTo(null);
            aboutUsDialog.setVisible(true);
        } else if (e.getSource().equals(stopBt)) {
            startBt.setEnabled(true);
            stopBt.setEnabled(false);
            grapPage.setStopflag(true);
        } else if (e.getSource().equals(importBt)) {
            if (this.listRecords.getRowCount() == 0) {
                return;
            }
            if (user.getVip() != 1) {
                JOptionPane.showMessageDialog(this, "非VIP会员不能导出数据！", "导出提示", JOptionPane.WARNING_MESSAGE);
                return;
            }
            File file = new File(confName.getText() + ".xls");
            this.chooser.setSelectedFile(file);
            int retval = this.chooser.showSaveDialog(this);
            if (retval == 0) {
                file = this.chooser.getSelectedFile();
                exportExcel(file.getAbsolutePath());
            }
        } else if (e.getSource().equals(clearBt)) {
            listRecords.setRowCount(0);
        } else if (e.getSource().equals(saveItem)) {
            //fileChooser = new JFileChooser();
            File file = new File(confName.getText() + ".obj");
            this.chooser.setSelectedFile(file);
            int retval = this.chooser.showSaveDialog(this);
            if (retval == 0) {
                saveConf();
                file = this.chooser.getSelectedFile();

                try {
                    if (file.exists() == false) {
                        file.createNewFile();
                    }

                    FileWriter writer = new FileWriter(file);
                    JSONObject json = JSONObject.fromObject(conf);
                    String arry = json.toString();
                    writer.write(arry);
                    writer.flush();
                    writer.close();
                } catch (IOException ex) {

                }
            }

        } else if (e.getSource().equals(openItem)) {
            int retval;

            retval = chooser.showOpenDialog(this);//显示"保存文件"对话框
            if (retval == JFileChooser.APPROVE_OPTION) {//若成功打开
                File file = chooser.getSelectedFile();//得到选择的文件名
                if (file.isFile() && file.exists()) {
                    InputStreamReader read = null;
                    StringBuffer sb = new StringBuffer();
                    try {
                        //判断文件是否存在
                        read = new InputStreamReader(
                                new FileInputStream(file), "utf-8"); //考虑到编码格式
                        BufferedReader bufferedReader = new BufferedReader(read);
                        String lineTxt = null;
                        while ((lineTxt = bufferedReader.readLine()) != null) {
                            sb.append(lineTxt);
                        }
                        JSONObject jsonObject = JSONObject.fromObject(sb.toString());
                        Map<String, Class> classMap = new HashMap<String, Class>();
                        classMap.put("fields", Field.class);
                        conf = (Conf) JSONObject.toBean(jsonObject, Conf.class, classMap);
                        updateUI();
                        read.close();
                    } catch (Exception ex) {

                    } finally {
                        try {
                            read.close();
                        } catch (IOException ex) {

                        }
                    }
                }
            }
        }
    }

    public void updateUI() {
        for (int i = 0; i < conf.getFields().size(); i++) {
            if (conf.getFields().get(i).isIsUse()) {
                if (i == 0) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field1Val);
                    field1Check.setSelected(conf.getFields().get(i).isIsUse());
                    field1.setText(conf.getFields().get(i).getFieldName());
                    field1Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 1) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field2Val);
                    field2Check.setSelected(conf.getFields().get(i).isIsUse());
                    field2.setText(conf.getFields().get(i).getFieldName());
                    field2Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 2) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field3Val);
                    field3Check.setSelected(conf.getFields().get(i).isIsUse());
                    field3.setText(conf.getFields().get(i).getFieldName());
                    field3Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 3) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field4Val);
                    field4Check.setSelected(conf.getFields().get(i).isIsUse());
                    field4.setText(conf.getFields().get(i).getFieldName());
                    field4Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 4) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field5Val);
                    field5Check.setSelected(conf.getFields().get(i).isIsUse());
                    field5.setText(conf.getFields().get(i).getFieldName());
                    field5Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 5) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field6Val);
                    field6Check.setSelected(conf.getFields().get(i).isIsUse());
                    field6.setText(conf.getFields().get(i).getFieldName());
                    field6Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 6) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field7Val);
                    field7Check.setSelected(conf.getFields().get(i).isIsUse());
                    field7.setText(conf.getFields().get(i).getFieldName());
                    field7Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 7) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field8Val);
                    field8Check.setSelected(conf.getFields().get(i).isIsUse());
                    field8.setText(conf.getFields().get(i).getFieldName());
                    field8Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 8) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field9Val);
                    field9Check.setSelected(conf.getFields().get(i).isIsUse());
                    field9.setText(conf.getFields().get(i).getFieldName());
                    field9Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                } else if (i == 9) {
                    setPathText(conf.getFields().get(i).getFieldVal(), field10Val);
                    field10Check.setSelected(conf.getFields().get(i).isIsUse());
                    field10.setText(conf.getFields().get(i).getFieldName());
                    field10Get.setText(conf.getFields().get(i).getFieldGet().getValue());
                }

            }
        }
        if (conf.getLoginconf().isNeedLogin()) {
            isNeedLoginCheck.setSelected(true);
            loginUrlField.setText(conf.getLoginconf().getLoginUrl());
        }
        pageCount.setValue(conf.getListConf().getPageCount());
        waitTime.setText(String.valueOf(conf.getWaitTime()));
        listField.setText(conf.getListConf().getUrl());
        setPathText(conf.getListConf().getNextUrl(), fenyeField);
        setPathText(conf.getListConf().getListPath(), listPath);
        confName.setText(conf.getConfName());
    }

    public void exportExcel(String filename) {
        HSSFWorkbook wb = new HSSFWorkbook();

        HSSFSheet sheet = wb.createSheet("采集数据");

        HSSFRow row = sheet.createRow(0);

        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment((short) 2);
        HSSFCell cell = row.createCell((short) 0);
        for (int i = 0; i < conf.getFields().size(); i++) {
            cell = row.createCell((short) i);
            cell.setCellValue((String) conf.getFields().get(i).getFieldName());
            cell.setCellStyle(style);
        }
        for (int i = 0; i < this.listRecords.getRowCount(); i++) {
            row = sheet.createRow(i + 1);
            int k = 0;
            for (int j = 0; j < conf.getFields().size(); j++) {

                if (conf.getFields().get(j).isIsUse()) {
                    cell = row.createCell((short) k);
                    cell.setCellValue(String.valueOf(this.listRecords.getValueAt(i,
                            k)));
                    k++;
                }
            }

        }

        try {
            FileOutputStream fout = new FileOutputStream(filename);
            wb.write(fout);
            fout.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run() {

        grapPage.parse(webDriver, conf);
    }

    public void setPathText(Path path, JTextField jt) {

        switch (path.getType()) {
            case className:
                jt.setText("className");
                break;
            case cssSelector:
                jt.setText("cssSelector");
                break;
            case id:
                jt.setText("id");
                break;
            case linkText:
                jt.setText("linkText");
                break;
            case name:
                jt.setText("linkText");
                break;
            case partialLinkText:
                jt.setText("partialLinkText");
                break;
            case tagName:
                jt.setText("tagName");
                break;
            case xpath:
                jt.setText("xpath");
                break;
            default:
                break;
        }

    }
}
